/* @tweakable Background color for the question display area */
:root {
    --question-display-bg: #f9f9f9;
    /* @tweakable The font size for the rendered math questions */
    --question-font-size: 1.5em;
    --primary-color: #007aff;
    --secondary-color: #28a745;
    --light-gray: #f0f2f5;
    --medium-gray: #e9ecef;
    --dark-gray: #495057;
    --text-color: #333;
    --border-color: #ced4da;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    display: flex;
    flex-direction: column; /* Allow footer to sit below */
    justify-content: flex-start; /* Align container to top */
    align-items: center; 
    min-height: 100vh;
    margin: 0;
    background-color: var(--light-gray);
    color: var(--text-color);
    padding: 20px;
    box-sizing: border-box;
}

.container {
    background-color: #ffffff;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    max-width: 800px; 
    width: 95%;
    margin-bottom: 20px; /* Space before footer */
}

h1 {
    color: var(--primary-color); 
    margin-bottom: 25px; 
    font-weight: 600;
    text-align: center;
}

.question-headerbox {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 5px;
}

#topic-chooser-btn {
    background-color: var(--secondary-color);
}
#topic-chooser-btn:hover {
    background-color: #1e7e34;
}

#current-topic-display {
    font-size: 1em;
    color: #555;
}
#current-topic-title {
    font-weight: bold;
}


#topic-selector-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--medium-gray);
    border-radius: 8px;
}

#topic-selector-panel.hidden {
    display: none;
}

.topic-button { /* Renamed from category-button */
    background-color: #f8f9fa;
    color: var(--dark-gray);
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    font-size: 0.9em;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.topic-button:hover {
    background-color: #e2e6ea;
    border-color: #adb5bd;
}

.topic-button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}


#controls-area {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fdfdfd;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.control-group label {
    font-size: 0.85em;
    margin-bottom: 5px;
    color: #555;
}
.control-group input[type="number"] {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    width: 80px; /* Adjust as needed */
    font-size: 0.9em;
}


#question-display-box {
    min-height: 150px; 
    border: 1px solid #e0e0e0; 
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px; 
    background-color: var(--question-display-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto; 
    font-size: var(--question-font-size); /* KaTeX output size */
    line-height: 1.7;
    color: var(--text-color);
    text-align: center; /* Center KaTeX block */
}
#question-placeholder {
    color: #777;
    font-size: 1rem; /* Smaller than question font */
}

/* KaTeX specific styling if needed */
.katex-display { /* Ensure KaTeX display math is centered if it's not by default */
    margin: 0 auto;
}


#action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px; 
    margin-bottom: 20px;
}

.button, #copy-btn { /* General button styling */
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px; 
    font-size: 0.95em; 
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.25s ease, transform 0.15s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.button:hover, #copy-btn:hover {
    background-color: #005ecb; 
}

.button:active, #copy-btn:active {
    transform: scale(0.97);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.generate-button { /* Specific style for generate if needed */
    padding: 12px 24px;
    font-size: 1em;
}

#copy-btn {
    background-color: var(--secondary-color); 
}
#copy-btn:hover {
    background-color: #1e7e34; 
}


footer {
    background-color: #fff;
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 800px; /* Match container width */
    box-sizing: border-box;
    border-radius: 0 0 12px 12px; /* Rounded bottom corners if container is rounded */
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85em;
    color: #555;
    position: relative; /* Or fixed if you want it sticky */
    bottom: 0;
}
footer div {
    display: flex;
    align-items: center;
    gap: 10px;
}
footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}
footer a:hover {
    color: #005ecb;
}

/* Hide scrollbar from KaTeX if it adds one unnecessarily in some cases */
.katex {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}
.katex::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}